前端如何设置背景颜色的透明度 css中的 rgba() 函数详解 :background 您所在的位置:网站首页 css 透明颜色在其他浏览器中失效 前端如何设置背景颜色的透明度 css中的 rgba() 函数详解 :background

前端如何设置背景颜色的透明度 css中的 rgba() 函数详解 :background

#前端如何设置背景颜色的透明度 css中的 rgba() 函数详解 :background| 来源: 网络整理| 查看: 265

文章目录 前言rgba() 函数 详解总结

前言

今天写毕设页面需要用到背景虚化就用了这行代码

background-color: rgba(255,255,255,0);

效果如图: 在这里插入图片描述

rgba() 函数 详解

rgba() 函数使用红®、绿(g)、蓝(b)、透明度(a)的叠加来生成各式各样的颜色。

rgba 即红色、绿色、蓝色、透明度(red, green, blue, alpha) 在对应的位置就代表对应的颜色以及透明度

红色(r)0 到 255 间的整数,代表颜色中的红色成分 绿色(g)0 到 255 间的整数,代表颜色中的绿色成分 蓝色(b)0 到 255 间的整数,代表颜色中的蓝色成分 透明度(a)取值 0~1 之间, 代表透明度 例如:

background-color:rgba(255,0,0,0.5); //红色 background-color:rgba(0,255,0,0.5); //绿色 background-color:rgba(0,0,255,0.5); //蓝色 background-color: rgba(255, 255, 255, 0); //则表示完全透明的白色 background-color: rgba(0, 0, 0, 1); //则表示完全不透明度的黑色 总结

提示:这里对文章进行总结:

“Once you realize how beautiful you are, you will find it hard to keep the company of those who do not.”



【本文地址】

公司简介

联系我们

今日新闻

    推荐新闻

    专题文章
      CopyRight 2018-2019 实验室设备网 版权所有